<template>
	<view class="nav-bar-wrap">
		<!--图标入口-->
		<view class="diy-navbar" :style="{background:itemData.style.background}">
			<view class="item" v-for="(item, index) in itemData.data" :key="index" :style="'width:'+item_width+';'" @click="gotoDetail(item)">
				<image :src="item.imgUrl" mode="widthFix"></image>
				<text class="gray3" :style="{color:item.color}">{{item.text}}</text>
			</view>
		</view>
		
		<!-- <u-button text="以租代购" @click="lease" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))"></u-button> -->
		<!-- <view class="" @click="lease">
			<image :src=" baseurl + '/image/Group.jpg'" mode="heightFix"></image>
		</view> -->
	</view>
</template>

<script>
	import baseurl from "@/config.js"
	export default {
		data() {
			return {
				baseurl:'',
				//单个宽度
				item_width: '25%'
			}
		},
		props: ['itemData'],
		created() {
			this.item_width = 100 / Math.abs(this.itemData.style.rowsNum) + '%';
			// console.log("itemData",this.itemData);
			this.baseurl = baseurl.app_url;
		},
		methods: {
			/*跳转页面*/
			gotoDetail(e) {
				console.log(e.linkUrl,"console.log(e.linkUrl);");
				 this.gotoPage(e.linkUrl);
			},
			// 跳转以租代购
			lease(){
				uni.navigateTo({
					url:"/pages/order/lease"
				})
			},
		}
	}
</script>

<style>
	.nav-bar-wrap {
		width: 710rpx;
		margin: 20rpx;
		border-radius: 20rpx;
		overflow: hidden;
	}

	.diy-navbar {
		/* margin: 20rpx; */
		/* padding: 20rpx 0; */
		border-radius: 6rpx;
		background: #FFFFFF;
		display: flex;
		justify-content: flex-start;
		flex-wrap: wrap;
	}

	.diy-navbar .item {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin-top: 20rpx;
		/* width: 120rpx;
		height: 140rpx; */
	}

	.diy-navbar .item image {
		width: 100rpx;
		height: 100rpx;
	}

	.diy-navbar .item text {
		display: block;
		text-overflow: ellipsis;
		white-space: nowrap;
		width: 100%;
		overflow: hidden;
		line-height: 66rpx;
		font-size: 26rpx;
		text-align: center;
	}
</style>
